// const webpack = require('webpack')
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.common')
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

const webpackConfig = merge(commonConfig, {
  mode: 'production',
  devtool: 'none',
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: '/',
    filename: 'js/[name].bundle.js',
    chunkFilename: 'js/[id].chunk.js'
  },
  optimization: {
    minimize: true
  },
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        path.join(__dirname, 'public')
      ]
    })
  ]
})

module.exports = webpackConfig
